package org.example.com.controller;

import lombok.extern.slf4j.Slf4j;
import org.example.com.bean.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Slf4j
// url:网址
// 给我的类起一个网址路径
@Controller
@RequestMapping("/first")
public class firstController {
    @RequestMapping("/a")
    public String a(){
    log.info("firstController 的a方法");
        // 默认情况下，这个是返回的页面名称
        return "index";
    }
    @RequestMapping("/b")
    public String b(){
        log.info("firstController 的b方法");
        return "index";
    }
    @RequestMapping("/c")
    public String c(@RequestParam("name") String name){
        log.info("firstController 的c方法,接收参数为{}",name);
        return "index";
    }
    @RequestMapping("/d")
    public String d(@RequestParam("name") String name,@RequestParam("age") int age,@RequestParam("loves") String [] loves){
        log.info("firstController 的d方法,接收参数为{},{},{}",name,age,loves);
        return "index";
    }
    @RequestMapping("/e")
    public String e(User user){
        log.info("firstController 的e方法,接收参数{}",user);
        return "index";
    }
    @RequestMapping("/f")
    public String f(){
        log.info("firstController 的f方法,接收参数");
        return "redirect:/index.html";
    }

}
